1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.webphotos.web.action;
17
18 import javax.servlet.http.HttpServletRequest;
19 import javax.servlet.http.HttpServletResponse;
20 import net.sf.webphotos.dao.jpa.AlbumDAO;
21 import org.apache.commons.logging.Log;
22 import org.apache.commons.logging.LogFactory;
23 import org.apache.struts.action.Action;
24 import org.apache.struts.action.ActionForm;
25 import org.apache.struts.action.ActionForward;
26 import org.apache.struts.action.ActionMapping;
27
28
29
30
31
32 public class IndexAction extends Action {
33
34 private static final String SUCCESS = "success";
35 private static final Log log = LogFactory.getLog(IndexAction.class);
36
37 private AlbumDAO albunsDAO;
38
39
40
41
42
43
44
45
46
47
48 @Override
49 public ActionForward execute(ActionMapping mapping, ActionForm form,
50 HttpServletRequest request, HttpServletResponse response)
51 throws Exception {
52
53 log.info("Starting Action \"" + this.getClass().getName() + "\"");
54
55 request.setAttribute("requestURL", request.getRequestURL());
56
57 request.setAttribute("albunsVO", albunsDAO.findAll());
58
59 return mapping.findForward(SUCCESS);
60 }
61
62
63
64
65 public AlbumDAO getAlbunsDAO() {
66 return albunsDAO;
67 }
68
69
70
71
72 public void setAlbunsDAO(AlbumDAO albunsDAO) {
73 this.albunsDAO = albunsDAO;
74 }
75 }